package com.ruoyi.challenge_cup.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.challenge_cup.mapper.ChallengeCupMapper;
import com.ruoyi.challenge_cup.domain.ChallengeCup;
import com.ruoyi.challenge_cup.service.IChallengeCupService;

/**
 * 挑战杯Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-13
 */
@Service
public class ChallengeCupServiceImpl implements IChallengeCupService 
{
    @Autowired
    private ChallengeCupMapper challengeCupMapper;

    /**
     * 查询挑战杯
     * 
     * @param ccId 挑战杯主键
     * @return 挑战杯
     */
    @Override
    public ChallengeCup selectChallengeCupByCcId(Long ccId)
    {
        return challengeCupMapper.selectChallengeCupByCcId(ccId);
    }

    /**
     * 查询挑战杯列表
     * 
     * @param challengeCup 挑战杯
     * @return 挑战杯
     */
    @Override
    @DataScope(deptAlias = "d",userAlias = "d")
    public List<ChallengeCup> selectChallengeCupList(ChallengeCup challengeCup)
    {
        return challengeCupMapper.selectChallengeCupList(challengeCup);
    }

    /**
     * 新增挑战杯
     * 
     * @param challengeCup 挑战杯
     * @return 结果
     */
    @Override
    public int insertChallengeCup(ChallengeCup challengeCup)
    {
        return challengeCupMapper.insertChallengeCup(challengeCup);
    }

    /**
     * 修改挑战杯
     * 
     * @param challengeCup 挑战杯
     * @return 结果
     */
    @Override
    public int updateChallengeCup(ChallengeCup challengeCup)
    {
        challengeCup.setUpdateTime(DateUtils.getNowDate());
        return challengeCupMapper.updateChallengeCup(challengeCup);
    }

    /**
     * 批量删除挑战杯
     * 
     * @param ccIds 需要删除的挑战杯主键
     * @return 结果
     */
    @Override
    public int deleteChallengeCupByCcIds(Long[] ccIds)
    {
        return challengeCupMapper.deleteChallengeCupByCcIds(ccIds);
    }

    /**
     * 删除挑战杯信息
     * 
     * @param ccId 挑战杯主键
     * @return 结果
     */
    @Override
    public int deleteChallengeCupByCcId(Long ccId)
    {
        return challengeCupMapper.deleteChallengeCupByCcId(ccId);
    }
}
